<div class="welcome">
     <?php if(isset($_GET["er"])&&$_GET["er"]="noaccess"){?>
    <div id="error" style="margin: 5px;">You do not have the permission to view the requested page</div>
    <?php } ?>
    <div class="ptitle">Admin Functions</div>
    <ul>
<?php
$pagesStart = false;
 $userPrivileges = getUserTask();

for($i=1;$i<=count( $userPrivileges);$i++){
    if(!$pagesStart && strlen($userPrivileges[$i]["index"])>0){
    $pagesStart = !$pagesStart;
        ?>
    </ul>
    <div class="ptitle">Pages </div>
    <ul>
        <?php }
        $otherlink="";
        if(strlen($userPrivileges[$i]["index"])>0){
            $otherlink  = "&index=".$userPrivileges[$i]["index"]."&itemid=".$userPrivileges[$i]["index"];
        } ?>
    <li><a href="?page=<?php echo $userPrivileges[$i]["page"] ?><?php echo $otherlink; ?>"><?php echo $userPrivileges[$i]["title"] ?></a></li>
<?php } ?>
</ul>
    <div class="clear"></div>
</div>